
#include "net_hard.h"

Net_hard::Net_hard():Qpixmapitem()
{

}

Net_hard::Net_hard(QString filename,QGraphicsScene* scene):Qpixmapitem(filename,scene)
{

}


void Net_hard::advance(int phase)
{

    if(this->collidingItems().count()>0)
    {
        QList<QGraphicsItem *> fishlist=this->collidingItems();//fishlist是所有被网碰撞到的鱼的链表
        fish=(Fish_hard*)(*fishlist.begin());


        fish->setPos(-300,100+rand()%1000);//把鱼移动到初始位置，相当于捕获了鱼

        }

    this->hide();//隐藏渔网
    delete this;//释放渔网占用的内存空间
}



